<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:pe="http://primefaces.org/ui/extensions"
	xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:cfn="http://web.conquest.meb.org/function"
	xmlns:pretty="http://ocpsoft.com/prettyfaces" template="/WEB-INF/templates/ui.xhtml">

	<ui:define name="content">
		<p:dataTable var="item" value="#{deckListCtrl.deckItems}" sortMode="multiple"
			rowStyleClass="faction-image-container-md">

			<p:column>
				<p:rowToggler />
			</p:column>

			<p:column headerText="Nazwa" sortBy="#{item.deck.name}">
				<h:outputText value="#{item.deck.name}&nbsp;" />
			</p:column>
			
			<p:column headerText="Frakcja" sortBy="#{item.deck.warlord.factionDisplay}"
				style="text-align: center;">
				<h:graphicImage url="#{cfn:factionImagePathBase(item.deck.warlord.faction)}-b-md.png"
					title="#{item.deck.warlord.factionDisplay}" />
			</p:column>
			
			<p:column headerText="Lider" sortBy="#{item.deck.warlord.name}">
				<h:outputText value="#{item.deck.warlord.name}" />
			</p:column>
			
			<p:column>
				<p:button href="/#{localeCtrl.language}/deck/#{item.deck.id}" value="view" />
				<p:button href="/#{localeCtrl.language}/deck/build/#{item.deck.id}" value="edit" />
			</p:column>
			
			<p:column headerText="Utworzono" sortBy="#{item.deck.createDate}">
				<h:outputText value="#{item.deck.createDate}">
					<f:convertDateTime locale="#{localeCtrl.locale}" type="both" dateStyle="long"
						timeZone="#{webUser.timeZone}" timeStyle="long" />
				</h:outputText>
			</p:column>
			
			<p:column headerText="Zmodyfikowano" sortBy="#{item.deck.modifyDate}">
				<h:outputText value="#{item.deck.modifyDate}">
					<f:convertDateTime locale="#{localeCtrl.locale}" type="both" dateStyle="long" timeStyle="long"
						timeZone="#{webUser.timeZone}" />
				</h:outputText>
			</p:column>

			<p:rowExpansion>
				<ui:include src="cardGroups.xhtml">
					<ui:param name="_cardGroup" value="#{item.cardGroup}" />
					<ui:param name="_lineLayout" value="true" />
				</ui:include>
			</p:rowExpansion>
		</p:dataTable>
	</ui:define>

</ui:composition>